package cn.mjnxin.iot.gate.sender;

import cn.mjnxin.iot.base.domain.ChannelData;
import cn.mjnxin.iot.base.log.LogWorker;
import cn.mjnxin.iot.base.util.Direction;
import cn.mjnxin.iot.gate.worker.Gate2HostWorker;
import cn.mjnxin.iot.gate.worker.Gate2TerminalWorker;

/**
 * 网关数据发送
 * @author CLG 2023年10月10日
 * @version V1.0.0
 */
public class GateDataSender implements IChannelDataSender {
	@Override
	public void sendChannelData(ChannelData request, Direction direction) throws InterruptedException {
		if (direction == Direction.LEFT) {
			Gate2TerminalWorker.getInstance().add(request);
		}
		else if (direction == Direction.RIGHT) {
			Gate2HostWorker.getInstance().add(request);
		}
		else {
			LogWorker.logForce("not send");
		}
	}
}
